package com.zyh.server.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zyh.server.entity.MiaoshaGoods;
import com.zyh.server.service.MiaoshaGoodsService;
import com.zyh.server.mapper.MiaoshaGoodsMapper;
import com.zyh.server.vo.MiaoshaGoodsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author ZYH
 * @description 针对表【t_miaosha_goods】的数据库操作Service实现
 * @createDate 2024-11-18 09:50:32
 */
@Service
public class MiaoshaGoodsServiceImpl extends ServiceImpl<MiaoshaGoodsMapper, MiaoshaGoods>
		implements MiaoshaGoodsService {

	@Autowired
	private MiaoshaGoodsMapper miaoshaGoodsMapper;

	/**
	 * 分页查询
	 *
	 * @param pageNum
	 * @param pageSize
	 * @param goodsName
	 *
	 * @return
	 */
	@Override
	public IPage<MiaoshaGoodsVO> findGoodsByPage(Integer pageNum, Integer pageSize, String goodsName) {
		Page<MiaoshaGoodsVO> page = new Page<>(pageNum, pageSize);
		return miaoshaGoodsMapper.selectAllByPage(page, goodsName);
	}

	/**
	 * 查询一个秒杀商品详情
	 *
	 * @param id
	 *
	 * @return
	 */
	@Override
	public MiaoshaGoodsVO miaoshaGoodsDetails(Integer id) {
		return miaoshaGoodsMapper.selectOne(id);
	}
}




